class SimilarWordsController < ApplicationController

  def index
    @word = Word.find_by_id(params[:word_id], :include => :related_words)

    unless @word
      @div = :din_content
      @class_name = 'related_word'
      render :template => 'shared/error' and return
    end

    if @word.related_words.empty?
      @word.synchronise_related_terms
      @word.related_words.reload
    end

    @similar_words = @word.similar_words.paginate(:page => params[:page],
                                                  :per_page => 5)
  end

end
